<template>
	<view class="estateCom col-3e">
        <view class="titleWrap flex justify-between">
            <view class="title font15 fontBold">基础信息</view>
            <view class="more flex font12 col-grey" @click="toMoreDeatil">
                <text class="right-3">查看更多</text>
                <u-icon name="arrow-right" color="#8A8A8A" size="12"></u-icon>
            </view>
        </view>
        <view class="details flex">
            <view class="item width100" v-if="product.price">
                <view class="txtHidden">
                    <text class="title col-grey">均价：</text>
                    <text class="col-error fontBold">{{product.price}}元/m²</text>
                </view>
            </view>
            
            <view class="item width50" v-if="product.min_size || product.max_size">
                <view class="txtHidden">
                    <text class="title col-grey">建筑面积：</text>
                    {{product.min_size?(product.max_size?product.min_size+'-'+product.max_size : product.min_size) : ''}}m²
                </view>
            </view>
            
            <view class="item width50">
                <view class="txtHidden">
                    <text class="title col-grey">楼盘类型：</text>
                    {{base.base_type_display?base.base_type_display:'暂无'}}
                </view>
            </view>
            
            <view class="item width50">
                <text class="title col-grey">产权年限：</text>
                {{base.base_year?base.base_year+'年':'暂无'}}
            </view>
        </view>
	</view>
</template>

<script>
    import { mapState } from 'pinia';
    import { useConfigStore } from '@/store/index';
	export default {
		data() {
			return {
			}
		},
		props:{
			product: {
                type: Object,
                default: () => ({})
            },
            base: {
                type: Object,
                default: () => ({})
            }
		},
        computed:{
        	...mapState(useConfigStore, ['puid'])
        },
		methods:{
			toMoreDeatil(){
                uni.navigateTo({
                    url: `/pages/product/estate-message/index?productId=${this.product.id}&title=${this.product.title}&puid=${this.puid}&lat=${this.product.lat}&lng=${this.product.lng}&prepage=楼盘详情页-${this.product.id}-${this.product.title}`
                })
            }
		}
	}
</script>

<style scoped lang="scss">
    .width50{
        width: 50%;
    }
    .width100{
        width: 100%;
    }
	.estateCom{
        line-height: 1;
        margin: 50rpx 22rpx 0 22rpx;
        .titleWrap{
            justify-content: space-between;
        }
        .details{
            flex-wrap: wrap;
            justify-content: flex-start;
            .item{
                margin-top: 25rpx;
                line-height: 1.3;
            }
        }
	}
</style>